// Lindsay Gilmour
// Adam Lusch
// Dan Niceswanger
//
// Computer Graphics Project 2:
// Teapot racing!

#include "Track.h"

GLuint Track::baseList;
GLuint Track::bgList;

GLuint Track::leaves;
GLuint Track::wood;
GLuint Track::indoorwood;
GLuint Track::medRoadf;
GLuint Track::medRoadh;
GLuint Track::medRoad;
GLuint Track::medRoadTR;
GLuint Track::medRoadBL;
GLuint Track::medRoadTL;
GLuint Track::medRoadBR; 
GLuint Track::medRoad2;
GLuint Track::medRoad2TL;
GLuint Track::medRoad2BL;
GLuint Track::medRoad2TR;
GLuint Track::medRoad2BR;
GLuint Track::medRoad1L;
GLuint Track::medRoad1R;
GLuint Track::medRoad1UP;
GLuint Track::medRoadTriTR;
GLuint Track::medRoadTriTL;
GLuint Track::bumpers;
GLuint Track::grass;
GLuint Track::lake;
GLuint Track::sand;
GLuint Track::oil;
GLuint Track::people;
GLuint Track::checks;
GLuint Track::banner;
GLuint Track::startfinish;


void Track::setup()
{
	leaves = loadTex(TEXTURE_DIR + "leaves.jpg");
	wood = loadTex(TEXTURE_DIR + "wood.jpg");
	indoorwood = loadTex(TEXTURE_DIR + "indoorwood.jpg");
	medRoadf = loadTex(TEXTURE_DIR + "MediumRoad_full.png");
	medRoadh = loadTex(TEXTURE_DIR + "MediumRoadhalf.png");
	medRoad = loadTex(TEXTURE_DIR + "MediumRoad.png");
	medRoad2 = loadTex(TEXTURE_DIR + "MediumRoad2.png");
	medRoad2TL = loadTex(TEXTURE_DIR + "MediumRoad_BL2.png");
	medRoad2BL = loadTex(TEXTURE_DIR + "MediumRoad_TL2.png");
	medRoad2TR = loadTex(TEXTURE_DIR + "MediumRoad_TR2.png");
	medRoad2BR = loadTex(TEXTURE_DIR + "MediumRoad_BR2.png");
	medRoadTR = loadTex(TEXTURE_DIR + "MediumRoad_TR.png");
	medRoadBL = loadTex(TEXTURE_DIR + "MediumRoad_BL.png");
	medRoadTL = loadTex(TEXTURE_DIR + "MediumRoad_TL.png");
	medRoadBR = loadTex(TEXTURE_DIR + "MediumRoad_BR.png");
	medRoad1L = loadTex(TEXTURE_DIR + "MediumRoadOneL.png");
	medRoad1R = loadTex(TEXTURE_DIR + "MediumRoadOneR.png");
	medRoad1UP = loadTex(TEXTURE_DIR + "MediumRoadOneUP.png");
	medRoadTriTR = loadTex(TEXTURE_DIR + "MediumRoadTriangle.png");
	medRoadTriTL = loadTex(TEXTURE_DIR + "MediumRoadTriangle2.png");
	bumpers = loadTex(TEXTURE_DIR + "bumpers.png");
	grass = loadTex(TEXTURE_DIR + "grass.png");
	lake = loadTex(TEXTURE_DIR + "Lake.png");
	sand = loadTex(TEXTURE_DIR + "sand.jpg");
	oil = loadTex(TEXTURE_DIR + "oil.png");
	people = loadTex(TEXTURE_DIR + "people.jpg");
	checks = loadTex(TEXTURE_DIR + "checks.png");
	banner = loadTex(TEXTURE_DIR + "banner.png");
	startfinish = loadTex(TEXTURE_DIR + "start-finish.png");
	
	baseList = glGenLists(1);
	
	glNewList(baseList, GL_COMPILE);
	
	drawMap();	
	
	glEndList();
	
	bgList = glGenLists(1);
	
	glNewList(bgList, GL_COMPILE);
	
	//Ground Plane
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, -18.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, -14.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, -10.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, -6.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, -2.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, 2.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, 6.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, 10.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, 14.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-24.0f, -0.01f, 18.0f);
	for (int i=0; i<12; i++) {
		drawGroundPlane();
		glTranslatef(4.0f, 0.0f, 0.0f);
	}
	glPopMatrix();
	
	glEndList();
}

void Track::cleanup()
{
	glDeleteLists(baseList, 1);
	glDeleteLists(bgList, 1);
}

Track::Track(b2World* world)
{
	b2BodyDef bodyDef;
	b2CircleDef circleDef;
	b2PolygonDef polyDef;
	b2Body* body;

	// Cones
	circleDef.radius = 0.25;
	bodyDef.position.Set(4.5, -1.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(4.5, 1.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(3.5, 3.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(5.5, 5.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(3.5, 7.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	// Poles
	circleDef.radius = 0.1;
	bodyDef.position.Set(-8.5, -12.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(-8.5, -9.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	//Bumpers
	circleDef.radius = 0.25;
	bodyDef.position.Set(-12.0, -12.25);
	polyDef.SetAsBox(2.5, 0.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&polyDef);
	bodyDef.position.Set(-9.5, -12.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	bodyDef.position.Set(-14.5, -12.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(-12.0, -9.75);
	polyDef.SetAsBox(2.5, 0.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&polyDef);
	bodyDef.position.Set(-9.5, -9.75);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	bodyDef.position.Set(-14.5, -9.75);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(3.5, -12.25);
	polyDef.SetAsBox(11.0, 0.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&polyDef);
	bodyDef.position.Set(-7.5, -12.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	bodyDef.position.Set(14.5, -12.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(3.5, -9.75);
	polyDef.SetAsBox(11.0, 0.25);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&polyDef);
	bodyDef.position.Set(-7.5, -9.75);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	bodyDef.position.Set(14.5, -9.75);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	// Stands
	bodyDef.position.Set(0.0, -15.2);
	polyDef.SetAsBox(14.6, 1.3);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&polyDef);
	
	// Trees
	circleDef.radius = 0.25;
	bodyDef.position.Set(-4.0, -5.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(0.0, -4.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(4.0, -4.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(11.0, 9.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(15.0, 8.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(4.0, 13.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(8.0, 13.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(10.0, 13.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(13.5, 13.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(16.0, 13.5);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(-12.0, 1.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(-13.0, 2.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	bodyDef.position.Set(-11.5, 6.0);
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&circleDef);
	
	// Track boundary
	b2PolygonDef boundDef;
	bodyDef.position.Set(0.0, 0.0);
	
	boundDef.vertices[3] = b2Vec2(-24.0, -18.0);
	boundDef.vertices[2] = b2Vec2(-26.0, -18.0);
	boundDef.vertices[1] = b2Vec2(-26.0, 22.0);
	boundDef.vertices[0] = b2Vec2(-24.0, 22.0);
	boundDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&boundDef);
	
	boundDef.vertices[3] = b2Vec2(24.0, -18.0);
	boundDef.vertices[2] = b2Vec2(24.0, 22.0);
	boundDef.vertices[1] = b2Vec2(26.0, 22.0);
	boundDef.vertices[0] = b2Vec2(26.0, -18.0);
	boundDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&boundDef);
	
	boundDef.vertices[3] = b2Vec2(-24.0, -18.0);
	boundDef.vertices[2] = b2Vec2(24.0, -18.0);
	boundDef.vertices[1] = b2Vec2(24.0, -20.0);
	boundDef.vertices[0] = b2Vec2(-24.0, -20.0);
	boundDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&boundDef);
	
	boundDef.vertices[3] = b2Vec2(-24.0, 22.0);
	boundDef.vertices[2] = b2Vec2(-24.0, 24.0);
	boundDef.vertices[1] = b2Vec2(24.0, 24.0);
	boundDef.vertices[0] = b2Vec2(24.0, 22.0);
	boundDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&boundDef);
	
	// Road
	b2PolygonDef roadDef;
	bodyDef.position.Set(0.0, 0.0);
	roadDef.isSensor = true;
	roadDef.userData = (void*)1337;
	
	roadDef.vertices[3] = b2Vec2(-15.0, -12.0);
	roadDef.vertices[2] = b2Vec2(-15.0, -10.0);
	roadDef.vertices[1] = b2Vec2(16.0, -10.0);
	roadDef.vertices[0] = b2Vec2(16.0, -12.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(16.0, -12.0);
	roadDef.vertices[2] = b2Vec2(16.0, -4.0);
	roadDef.vertices[1] = b2Vec2(18.0, -6.0);
	roadDef.vertices[0] = b2Vec2(18.0, -10.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(15.0, -10.0);
	roadDef.vertices[1] = b2Vec2(16.0, -9.0);
	roadDef.vertices[0] = b2Vec2(16.0, -10.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(16.0, -7.0);
	roadDef.vertices[1] = b2Vec2(15.0, -6.0);
	roadDef.vertices[0] = b2Vec2(16.0, -6.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(16.0, -6.0);
	roadDef.vertices[2] = b2Vec2(12.0, -6.0);
	roadDef.vertices[1] = b2Vec2(10.0, -4.0);
	roadDef.vertices[0] = b2Vec2(16.0, -4.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(12.0, -4.0);
	roadDef.vertices[1] = b2Vec2(12.0, -3.0);
	roadDef.vertices[0] = b2Vec2(13.0, -4.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(10.0, -4.0);
	roadDef.vertices[2] = b2Vec2(10.0, 0.0);
	roadDef.vertices[1] = b2Vec2(12.0, 0.0);
	roadDef.vertices[0] = b2Vec2(12.0, -4.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(12.0, -1.0);
	roadDef.vertices[1] = b2Vec2(12.0, 0.0);
	roadDef.vertices[0] = b2Vec2(13.0, 0.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(10.0, 0.0);
	roadDef.vertices[2] = b2Vec2(12.0, 2.0);
	roadDef.vertices[1] = b2Vec2(20.0, 2.0);
	roadDef.vertices[0] = b2Vec2(18.0, 0.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(17.0, 2.0);
	roadDef.vertices[1] = b2Vec2(18.0, 3.0);
	roadDef.vertices[0] = b2Vec2(18.0, 2.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(18.0, 2.0);
	roadDef.vertices[2] = b2Vec2(18.0, 12.0);
	roadDef.vertices[1] = b2Vec2(20.0, 10.0);
	roadDef.vertices[0] = b2Vec2(20.0, 2.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(18.0, 9.0);
	roadDef.vertices[1] = b2Vec2(17.0, 10.0);
	roadDef.vertices[0] = b2Vec2(18.0, 10.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[4] = b2Vec2(3.0, 10.0);
	roadDef.vertices[3] = b2Vec2(3.0, 11.0);
	roadDef.vertices[2] = b2Vec2(4.0, 12.0);
	roadDef.vertices[1] = b2Vec2(18.0, 12.0);
	roadDef.vertices[0] = b2Vec2(18.0, 10.0);
	roadDef.vertexCount = 5;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(6.0, 9.0);
	roadDef.vertices[1] = b2Vec2(6.0, 10.0);
	roadDef.vertices[0] = b2Vec2(7.0, 10.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[4] = b2Vec2(3.0, -3.0);
	roadDef.vertices[3] = b2Vec2(3.0, 10.0);
	roadDef.vertices[2] = b2Vec2(6.0, 10.0);
	roadDef.vertices[1] = b2Vec2(6.0, -2.0);
	roadDef.vertices[0] = b2Vec2(5.0, -3.0);
	roadDef.vertexCount = 5;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(2.0, -1.0);
	roadDef.vertices[1] = b2Vec2(3.0, 0.0);
	roadDef.vertices[0] = b2Vec2(3.0, -1.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-5.0, -3.0);
	roadDef.vertices[2] = b2Vec2(-7.0, -1.0);
	roadDef.vertices[1] = b2Vec2(3.0, -1.0);
	roadDef.vertices[0] = b2Vec2(3.0, -3.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[0] = b2Vec2(-5.0, -1.0);
	roadDef.vertices[1] = b2Vec2(-4.0, -1.0);
	roadDef.vertices[2] = b2Vec2(-5.0, 0.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-7.0, -1.0);
	roadDef.vertices[2] = b2Vec2(-7.0, 3.0);
	roadDef.vertices[1] = b2Vec2(-5.0, 3.0);
	roadDef.vertices[0] = b2Vec2(-5.0, -1.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-6.0, 3.0);
	roadDef.vertices[2] = b2Vec2(-6.0, 5.0);
	roadDef.vertices[1] = b2Vec2(-5.0, 5.0);
	roadDef.vertices[0] = b2Vec2(-5.0, 3.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-7.0, 5.0);
	roadDef.vertices[2] = b2Vec2(-7.0, 11.0);
	roadDef.vertices[1] = b2Vec2(-5.0, 9.0);
	roadDef.vertices[0] = b2Vec2(-5.0, 5.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(-7.0, 8.0);
	roadDef.vertices[1] = b2Vec2(-8.0, 9.0);
	roadDef.vertices[0] = b2Vec2(-7.0, 9.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-17.0, 9.0);
	roadDef.vertices[2] = b2Vec2(-15.0, 11.0);
	roadDef.vertices[1] = b2Vec2(-7.0, 11.0);
	roadDef.vertices[0] = b2Vec2(-7.0, 9.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[2] = b2Vec2(-15.0, 8.0);
	roadDef.vertices[1] = b2Vec2(-15.0, 9.0);
	roadDef.vertices[0] = b2Vec2(-14.0, 9.0);
	roadDef.vertexCount = 3;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-17.0, 3.0);
	roadDef.vertices[2] = b2Vec2(-17.0, 9.0);
	roadDef.vertices[1] = b2Vec2(-15.0, 9.0);
	roadDef.vertices[0] = b2Vec2(-15.0, 5.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[3] = b2Vec2(-17.0, -3.0);
	roadDef.vertices[2] = b2Vec2(-19.0, -1.0);
	roadDef.vertices[1] = b2Vec2(-19.0, 5.0);
	roadDef.vertices[0] = b2Vec2(-17.0, 7.0);
	roadDef.vertexCount = 4;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);

	roadDef.vertices[4] = b2Vec2(-16.0, -12.0);
	roadDef.vertices[3] = b2Vec2(-17.0, -11.0);
	roadDef.vertices[2] = b2Vec2(-17.0, 1.0);
	roadDef.vertices[1] = b2Vec2(-15.0, -1.0);
	roadDef.vertices[0] = b2Vec2(-15.0, -12.0);
	roadDef.vertexCount = 5;
	body = world->CreateBody(&bodyDef);
	body->CreateShape(&roadDef);
}

Track::~Track()
{
}

void Track::draw(bool renderBG) const
{
	glPushMatrix();
		glCallList(baseList);
		
		if(renderBG)
		{
			glCallList(bgList);
		}
		
	glPopMatrix();
}

//draw functions - there are a lot of them so hold on tight, eh?
void Track::drawSmallRoad() {
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoad);
	glBegin(GL_QUADS);
	glTexCoord2f(0.5f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.5f, 0.5f);
	glVertex3f(0.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 0.5f);
	glVertex3f(1.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.0f,0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawSmallRoad2() {
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoad2);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 0.5f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 1.0f);
	glTexCoord2f(0.5f, 0.0f);
	glVertex3f(1.0f, 0.0f, 1.0f);
	glTexCoord2f(0.5f, 0.5f);
	glVertex3f(1.0f,0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoadFull() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadf);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoadHalf() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadh);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad_TR() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadTR);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad_BL() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadBL);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad_TL() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadTL);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad_BR() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoadBR);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad2() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad2);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad2_TL() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad2TL);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad2_BL() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad2BL);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad2_BR() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad2BR);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad2_TR() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad2TR);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad1L() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad1L);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad1R() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad1R);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawMediumRoad1UP() {
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, medRoad1UP);
	glColor3f(1.0f, 1.0f, 1.0f);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(2.0f,0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}


void Track::drawLargeRoad() {
	glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, sand);
        glBegin(GL_QUADS);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 3.0f);
        glTexCoord2f(1.0f, 0.0f);
        glVertex3f(3.0f, 0.0f, 3.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(3.0f, 0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawBumpers() {
	GLUquadricObj *cylBump;
	cylBump = gluNewQuadric();
	gluQuadricTexture(cylBump, GL_TRUE);
	
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, bumpers);
	glRotatef(90, 0.0f, 1.0f, 0.0f);
	gluCylinder(cylBump, 0.25f, 0.25f, 1.0f, 25, 25);
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawFencePost() {
	
	GLUquadricObj *cylFence;
	cylFence = gluNewQuadric();
	gluQuadricTexture(cylFence, GL_TRUE);
	GLUquadricObj *sphereFence;
	sphereFence = gluNewQuadric();
	gluQuadricTexture(cylFence, GL_TRUE);
	
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, indoorwood);
	gluSphere(sphereFence, 0.1f, 30, 30);
	glTranslatef(0.0f, 0.2f, 0.0f);
	gluSphere(sphereFence, 0.1f, 30, 30);
	glTranslatef(0.0f, 0.75f, 0.0f);
	glRotatef(90, 1.0f, 0.0f, 0.0);
	gluCylinder(cylFence, 0.1f, 0.1f, 0.75f, 30, 30);
	gluSphere(sphereFence, 0.1f, 30, 30);
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawBanner() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, banner);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, -0.5f, 0.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(1.5f, -0.5f, 0.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.5f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}
	

void Track::drawSmallTriangle_TL() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTL);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.0f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawSmallTriangle_BL() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTR);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(1.0f, 0.0f, 1.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawSmallTriangle_BR() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTL);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(1.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.0f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawSmallTriangle_TR() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTR);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(1.0f, 0.0f, 1.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.0f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawLargeTriangle_TL() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTL);
	glBegin(GL_POLYGON);
        glTexCoord2f(0.0f, 1.0f);
        glVertex3f(0.0f, 0.0f, 0.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(0.0f, 0.0f, 2.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(2.0f, 0.0f, 0.0f);
        glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawLargeTriangle_BL() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTR);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 2.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(2.0f, 0.0f, 2.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawLargeTriangle_BR() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTL);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 2.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(2.0f, 0.0f, 2.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(2.0f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawLargeTriangle_TR() {
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, medRoadTriTR);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(2.0f, 0.0f, 2.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(2.0f, 0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawTrafficCone() {
	glColor3f(1.0f, 0.5f, 0.0f);
	
	GLUquadricObj *cylConeBottom;
	cylConeBottom = gluNewQuadric();
	GLUquadricObj *cylConeTop;
	cylConeTop = gluNewQuadric();

	glPushMatrix();
	glTranslatef(0.0f, 0.1f, 0.0f);
	glScalef(0.8f, 1.0f, 0.8f);
	glRotatef(90, 1.0f, 0.0f, 0.0f);
	gluCylinder(cylConeBottom, 0.3f, 0.3f, 0.2f, 30, 30);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f, 0.85f, 0.0f);
	glScalef(0.8f, 1.0f, 0.8f);
	glRotatef(90, 1.0f, 0.0f, 0.0f);
	gluCylinder(cylConeTop, 0.0f, 0.25f, 0.60f, 30, 30);
	glPopMatrix();
}

void Track::drawTree() {
	glColor3f(0.5f, 0.3f, 0.0f);

	GLUquadricObj *cylTrunk;
	cylTrunk = gluNewQuadric();
	gluQuadricTexture(cylTrunk, GL_TRUE);

	glEnable(GL_TEXTURE_2D);
	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, wood);
	glColor3f(1.0, 1.0, 1.0);
        glTranslatef(0.0f, 3.0f, 0.0f);
	glRotatef(90, 1.0f, 0.0f, 0.0f);
	gluCylinder(cylTrunk, 0.2f, 0.5f, 3.0f, 50, 50);
	glPopMatrix();
	
	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, wood);
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(0.0f, 2.1f, 0.0f);
	glRotatef(90, 0.0f, 1.0f, 0.15f);
	gluCylinder(cylTrunk, 0.1f, 0.05f, 0.5f, 50, 50);
	glPopMatrix();

	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, wood);
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(0.0f, 2.5f, 0.0f);
	glRotatef(-90, 0.0f, 1.25f, 0.75f);
	gluCylinder(cylTrunk, 0.15f, 0.05f, 0.7f, 50, 50);
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);

	
	GLUquadricObj *TreeLeaves;
	TreeLeaves = gluNewQuadric();
	gluQuadricTexture(TreeLeaves, GL_TRUE);

	glEnable(GL_TEXTURE_2D);
	glPushMatrix();
        glBindTexture(GL_TEXTURE_2D, leaves);
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(0.0f, 4.35f, 0.0f);
	gluSphere(TreeLeaves, 1.25f, 50, 50);
	glPopMatrix();

	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, leaves);
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(-1.2f, 3.2f, 0.0f);
	gluSphere(TreeLeaves, 0.5f, 50, 50);
	glPopMatrix();

	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, leaves);
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(0.85f, 2.3f, 0.0f);
	gluSphere(TreeLeaves, 0.3f, 50, 50);
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);
}

void Track::drawLake() {
	glPushMatrix();
	glColor3f(1.0f, 1.0f, 1.0f);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, lake);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 6.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(6.0f, 0.0f, 6.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(6.0f,0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();

	glPushMatrix();
	glScalef(0.5f, 0.45f, 0.5f);
	drawTree();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-1.0f, 0.0f, 1.0f);
	glScalef(0.5f, 0.45f, 0.5f);
	drawTree();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(0.5f, 0.0f, 5.0f);
	glScalef(0.5f, 0.45f, 0.5f);
	drawTree();
	glPopMatrix();
}

void Track::drawOil() {
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, oil);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 0.5f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(0.5f, 0.0f, 0.5f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(0.5f,0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawAudience() {
	//front plane
	glColor3f(0.5f, 0.5f, 0.5f);
	glPushMatrix();
	//glEnable(GL_TEXTURE_2D);
	//glBindTexture(GL_TEXTURE_2D, text15_2D);
	glBegin(GL_QUADS);
	//glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	//glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, -1.0f, 0.0f);
	//glTexCoord2f(1.0f, 0.0f);
	glVertex3f(29.0f, -1.0f, 0.0f);
	//glTexCoord2f(1.0f, 1.0f);
	glVertex3f(29.0f, 0.0f, 0.0f);
	//glDisable(GL_TEXTURE_2D);
	glEnd();
	glPopMatrix();
	
	//left side plane
	glColor3f(0.5f, 0.5f, 0.5f);
	glPushMatrix();
	//glEnable(GL_TEXTURE_2D);
	//glBindTexture(GL_TEXTURE_2D, text16_2D);
	glBegin(GL_QUADS);
	//glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 2.0f, -2.0f);
	//glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, -1.0f, -2.0f);
	//glTexCoord2f(1.0f, 0.0f);
	glVertex3f(0.0f, -1.0f, 0.0f);
	//glTexCoord2f(1.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	//glDisable(GL_TEXTURE_2D);
	glEnd();
	glPopMatrix();

	//top plane
	glColor3f(1.0f, 1.0f, 1.0f);
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, people);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 2.0f, -2.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(29.0f, 0.0f, 0.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(29.0f, 2.0f, -2.0f);
	glDisable(GL_TEXTURE_2D);
	glEnd();
	glPopMatrix();

	//right side plane
	glColor3f(0.5f, 0.5f, 0.5f);
	glPushMatrix();
	//glEnable(GL_TEXTURE_2D);
	//glBindTexture(GL_TEXTURE_2D, text18_2D);
	glBegin(GL_QUADS);
	//glTexCoord2f(0.0f, 1.0f);
	glVertex3f(29.0f, 2.0f, -2.0f);
	//glTexCoord2f(0.0f, 0.0f);
	glVertex3f(29.0f, -1.0f, -2.0f);
	//glTexCoord2f(1.0f, 0.0f);
	glVertex3f(29.0f, -1.0f, 0.0f);
	//glTexCoord2f(1.0f, 1.0f);
	glVertex3f(29.0f, 0.0f, 0.0f);
	//glDisable(GL_TEXTURE_2D);
	glEnd();
	glPopMatrix();
}

void Track::drawGroundPlane() {
	//groundplane
	glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, grass);
	glColor3f(1.0f, 1.0f, 1.0f);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, -0.01f, 0.0f);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, -0.01f, 4.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(4.0f, -0.01f, 4.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(4.0f, -0.01f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();
}

void Track::drawStartingLine() {
	
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, checks);
	glColor3f(1.0f, 1.0f, 1.0f);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, 0.0f);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.0f, 0.0f, 4.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(1.0f, 0.0f, 4.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(1.0f,0.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();

	//in drawStartingLine function
//flag goes here
	glPushMatrix();
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, startfinish);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.5f, 2.0f, 0.5f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(0.5f, 1.25f, 0.5f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(0.5f, 1.25f, 3.5f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(0.5f, 2.0f, 3.5f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glPopMatrix();


	//two poles
	GLUquadricObj *cylLeft;
	cylLeft = gluNewQuadric();
	GLUquadricObj *cylRight;
	cylRight = gluNewQuadric();

	
	glColor3f(0.5f, 0.5f, 0.5f);
	glShadeModel(GL_SMOOTH);
	GLfloat specularReflection[]={1.0,1.0,1.0,1.0};
        glMaterialfv(GL_FRONT, GL_SPECULAR, specularReflection);
        glMateriali(GL_FRONT, GL_SHININESS, 64);
	
	glPushMatrix();
	glTranslatef(0.5f, 1.0f, 0.5f);
	glRotatef(90, 1.0f, 0.0f, 0.0f);
	gluCylinder(cylLeft, 0.1f, 0.1f, 1.0f, 30, 30);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.25f);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.75f);
	gluCylinder(cylLeft, 0.1f, 0.1f, 0.75f, 30, 30);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.25f);
	glutSolidSphere(0.1f, 30, 30);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.5f, 1.0f, 3.5f);
	glRotatef(90, 1.0f, 0.0f, 0.0f);
	gluCylinder(cylLeft, 0.1f, 0.1f, 1.0f, 30, 30);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.25f);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.75f);
	gluCylinder(cylLeft, 0.1f, 0.1f, 0.75f, 30, 30);
	glutSolidSphere(0.1f, 30, 30);
	glTranslatef(0.0f, 0.0f, -0.25f);
	glutSolidSphere(0.1f, 30, 30);
	glPopMatrix();
}

void Track::drawMap() {
	glPushMatrix();
	//track
	glTranslatef(-5.0f, 0.0f, -3.0f); //(-5,-3)
	drawMediumRoad_BL();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-3,-3)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-1,-3)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(1,-3)
	drawMediumRoad_BR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(3,-3)
	drawSmallRoad();
	glTranslatef(1.0f, 0.0f, 0.0f); //(4,-3)
	drawSmallRoad();
	glTranslatef(1.0f, 0.0f, 0.0f); //(5,-3)
	drawSmallTriangle_BL();
	glTranslatef(-2.0f, 0.0f, 1.0f); //(3,-2)
	drawLargeRoad();
	glTranslatef(-1.0f, 0.0f, 1.0f); //(2,-1)
	drawSmallTriangle_TR();
	glTranslatef(1.0f, 0.0f, 2.0f); //(3,1)
	drawLargeRoad();
	glTranslatef(0.0f, 0.0f, 3.0f); //(3,4)
	drawLargeRoad();
	glTranslatef(0.0f, 0.0f, 3.0f); //(3,7)
	drawLargeRoad();
	glTranslatef(0.0f, 0.0f, 3.0f); //(3,10)
	drawSmallRoad2();
	glTranslatef(0.0f, 0.0f, 1.0f); //(3,11)
	drawSmallTriangle_TR();
	glTranslatef(1.0f, 0.0f, -1.0f); //(4,10)
	drawMediumRoad1UP();
	glTranslatef(2.0f, 0.0f, 0.0f); //(6,10)
	drawMediumRoad_TL();
	glTranslatef(0.0f, 0.0f, -1.0f); //(6,9)
	drawSmallTriangle_BL();
	glTranslatef(2.0f, 0.0f, 1.0f); //(8,10)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(10,10)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(12,10)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(14,10)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(16,10)
	drawMediumRoad_TR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(18,10)
	drawLargeTriangle_TL();
	glTranslatef(-1.0f, 0.0f, -1.0f); //(17,9)
	drawSmallTriangle_BR();
	glTranslatef(1.0f, 0.0f, -1.0f); //(18,8)
	drawMediumRoad2_BL();
	glTranslatef(0.0f, 0.0f, -2.0f); //(18,6)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, -2.0f); //(18,4)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, -2.0f); //(18,2)
	drawMediumRoad2_TL();
	glTranslatef(-1.0f, 0.0f, 0.0f); //(17,2)
	drawSmallTriangle_TR();
	glTranslatef(1.0f, 0.0f, -2.0f); //(18,0)
	drawLargeTriangle_BL();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(16,0)
	drawMediumRoad_BR();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(14,0)
	drawMediumRoad();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(12,0)
	drawMediumRoad_TL();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(10,0)
	drawLargeTriangle_TR();
	glTranslatef(2.0f, 0.0f, -1.0f); //(12,-1)
	drawSmallTriangle_BL();
	glTranslatef(-2.0f, 0.0f, -1.0f); //(10,-2)
	drawMediumRoad2_BR();
	glTranslatef(0.0f, 0.0f, -2.0f); //(10,-4)
	drawMediumRoad2_TR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(12,-4)
	drawSmallTriangle_TL();
	glTranslatef(-2.0f, 0.0f, -2.0f); //(10,-6)
	drawLargeTriangle_BR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(12,-6)
	drawMediumRoad_BL();
	glTranslatef(2.0f, 0.0f, 0.0f); //(14,-6)
	drawMediumRoad_TR();
	glTranslatef(1.0f, 0.0f, -1.0f); //(15,-7)
	drawSmallTriangle_BR();
	glTranslatef(1.0f, 0.0f, 1.0f); //(16,-6)
	drawLargeTriangle_TL();
	glTranslatef(0.0f, 0.0f, -2.0f); //(16,-8)
	drawMediumRoad2_BL();
	glTranslatef(0.0f, 0.0f, -2.0f); //(16,-10)
	drawMediumRoad2_TL();
	glTranslatef(-1.0f, 0.0f, 0.0f); //(15,-10)
	drawSmallTriangle_TR();
	glTranslatef(1.0f, 0.0f, -2.0f); //(16,-12)
	drawLargeTriangle_BL();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(14,-12)
	drawMediumRoadHalf();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(12,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(10,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(8,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(6,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(4,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(2,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(0,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-2,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-4,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-6,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-8,-12)
	drawMediumRoadFull();
	glTranslatef(-1.0f, 0.0f, -1.0f); //(-9,-13)
	//starting line goes here
	glTranslatef(-2.0f, 0.0f, 1.0f); //(-11,-12)
	//track	
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-13,-12)
	drawMediumRoadFull();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-15,-12)
	drawMediumRoadFull();
	glTranslatef(-1.0f, 0.0f, 0.0f); //(-16,-12)
	drawSmallRoad();
	glTranslatef(-1.0f, 0.0f, 0.0f); //(-17,-12)
	drawSmallTriangle_BR();
	glTranslatef(0.0f, 0.0f, 1.0f); //(-17,-11)
	drawMediumRoad2_TR();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-17,-9)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-17,-7)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-17,-5)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-17,-3)
	drawMediumRoad1R();
	glTranslatef(-2.0f, 0.0f, 0.0f); //(-19,-3)
	drawLargeTriangle_BR();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-19,-1)
	drawMediumRoad1L();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-17,-1)
	drawLargeTriangle_TL();
	glTranslatef(-2.0f, 0.0f, 2.0f); //(-19,1)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-19,3)
	drawMediumRoad1L();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-17,3)
	drawLargeTriangle_BL();
	glTranslatef(-2.0f, 0.0f, 2.0f); //(-19,5)
	drawLargeTriangle_TR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-17,5)
	drawMediumRoad1R();
	glTranslatef(0.0f, 0.0f, 2.0f); //(-17,7)
	drawMediumRoad2_BR();
	glTranslatef(2.0f, 0.0f, 1.0f); //(-15,8)
	drawSmallTriangle_BL();
	glTranslatef(-2.0f, 0.0f, 1.0f); //(-17,9)
	drawLargeTriangle_TR();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-15,9)
	drawMediumRoad_TL();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-13,9)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-11,9)
	drawMediumRoad();
	glTranslatef(2.0f, 0.0f, 0.0f); //(-9,9)
	drawMediumRoad_TR();
	glTranslatef(1.0f, 0.0f, -1.0f); //(-8,8)
	drawSmallTriangle_BR();
	glTranslatef(1.0f, 0.0f, 1.0f); //(-7,9)
	drawLargeTriangle_TL();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,7)
	drawMediumRoad2_BL();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,5)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,3)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,1)
	drawMediumRoad2();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,-1)
	drawMediumRoad2_TR();
	glTranslatef(0.0f, 0.0f, -2.0f); //(-7,-3)
	drawLargeTriangle_BR();
	glTranslatef(2.0f, 0.0f, 2.0f); //(-5, -1)
	drawSmallTriangle_TL();
	glPopMatrix();

	//trees
	glPushMatrix();
	glTranslatef(-4.0f, 0.0f, -5.0f);
	glScalef(0.5f, 0.45f, 0.5f);
	drawTree();
	glPopMatrix();
	
	glPushMatrix();
	glTranslatef(0.0f, 0.0f, -4.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(30, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(4.0f, 0.0f, -4.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(170, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(11.0f, 0.0f, 9.0f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(45, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(15.0f, 0.0f, 8.0f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(300, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(4.0f, 0.0f, 13.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(215, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(8.0f, 0.0f, 13.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(65, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(10.0f, 0.0f, 13.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(10, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(13.5f, 0.0f, 13.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(110, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(16.0f, 0.0f, 13.5f);
	glScalef(0.5f, 0.45f, 0.5f);
	glRotatef(90, 0.0f, 1.0f, 0.0f);
	drawTree();
	glPopMatrix();

	//traffic cones
	glPushMatrix();
	glTranslatef(4.5f, 0.0f, -1.5f); //(4.5,-1.5)
	drawTrafficCone();
	glTranslatef(0.0f, 0.0f, 3.0f); //(4.5,1.5)
	drawTrafficCone();
	glTranslatef(-1.0f, 0.0f, 2.0f); //(3.5,3.5)
	drawTrafficCone();
	glTranslatef(2.0f, 0.0f, 2.0f); //(5.5,5.5)
	drawTrafficCone();
	glTranslatef(-2.0f, 0.0f, 2.0f); //(3.5,7.5);
	drawTrafficCone();
	glTranslatef(1.0f, 0.0f, 1.0f); //(4.5, 8.5);
	glPopMatrix();

	//bumpers
	//topbumpers
	glPushMatrix();
	glColor3f(1.0f, 1.0f, 1.0f);
	glTranslatef(-14.5f, 0.0f, -12.25f);
	glRotatef(180, 0.0f, 0.0f, 1.0f);
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	drawBumpers();
	for (int i=0; i<4; i++)
	{
		glTranslatef(-1.0f, 0.0f, 0.0f);
		drawBumpers();
	}
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	//starting line is here
	glTranslatef(-1.0f, 0.0f, 0.0f);
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	drawBumpers();
	for (int i=0; i<21; i++)
	{
		glTranslatef(-1.0f, 0.0f, 0.0f);
		drawBumpers();
	}
	glutSolidSphere(0.25f, 30, 30);
	glPopMatrix();

	//bottombumpers
	glPushMatrix();
	glTranslatef(-14.5f, 0.0f, -9.75f);
	glRotatef(180, 0.0f, 0.0f, 1.0f);
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	drawBumpers();
	for (int i=0; i<4; i++)
	{
		glTranslatef(-1.0f, 0.0f, 0.0f);
		drawBumpers();
	}
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	//starting line is here
	glTranslatef(-1.0f, 0.0f, 0.0f);
	glutSolidSphere(0.25f, 30, 30);
	glTranslatef(-1.0f, 0.0f, 0.0f);
	drawBumpers();
	for (int i=0; i<21; i++)
	{
		glTranslatef(-1.0f, 0.0f, 0.0f);
		drawBumpers();
	}
	glutSolidSphere(0.25f, 30, 30);
	glPopMatrix();

	//fence
	glPushMatrix();
	glColor3f(1.0f, 1.0f, 1.0);
	glTranslatef(-14.5f, 0.0f, -14.0f);
	drawFencePost();
	glTranslatef(0.0f, 0.8f, 0.0f);
	for(int i=0; i<3; i++) {
		drawBanner();
		glTranslatef(1.5f, 0.0f, 0.0f);
	}
	glTranslatef(0.0f, -0.8f, 0.0f);
	drawFencePost();

	glTranslatef(3.0f, 0.0f, 0.0f);
	drawFencePost();
	glTranslatef(0.0f, 0.8f, 0.0f);
	for(int i=0; i<14; i++) {
		drawBanner();
		glTranslatef(1.5f, 0.0f, 0.0f);
	}
	glTranslatef(0.0f, -0.8f, 0.0f);
	drawFencePost();
	glPopMatrix();

	//Lake
	glPushMatrix();
	glTranslatef(-12.0f, 0.01f, 1.0f);
	drawLake();
	glPopMatrix();

	//oil hazards
	glPushMatrix();
	glTranslatef(17.25f, 0.01f, -8.75f);
	drawOil();
	glTranslatef(-1.0f, 0.0f, 2.0f);
	drawOil();
	glTranslatef(-1.0f, 0.0f, 17.0f);
	drawOil();
	glTranslatef(-2.0f, 0.0f, 1.0f);
	drawOil();
	glTranslatef(-5.0f, 0.0f, -1.0f);
	drawOil();
	glTranslatef(-27.0f, 0.0f, -6.0f);
	drawOil();
	glTranslatef(1.0f, 0.0f, -3.0f);
	drawOil();
	glTranslatef(1.0f, 0.0f, -6.0f);
	drawOil();
	glPopMatrix();

	//Audience
	glPushMatrix();
	glTranslatef(-14.5f, 1.0f, -14.5f);
	drawAudience();
	glPopMatrix();
	
	//Starting Line
	//draw starting line last
	//starting line
	glPushMatrix();
	glTranslatef(-9.0f, 0.0f, -13.0f);
	drawStartingLine();
	glPopMatrix();
}

